package fzu.functiongather.CarouselPicture;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;


import fzu.functiongather.Model.GetBanner;
import fzu.functiongather.R;
import fzu.functiongather.Utils.BannerViewPager;
import fzu.functiongather.Utils.ToastUtils;
import lombok.Getter;

/**
 * Created by Administrator on 2016/8/26.
 */
public class CarouselPictureActivity extends Activity {
    private BannerViewPager bvp_vKeBao_bannnerHome;
    private List<GetBanner.Img> smHomepageImageList = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.carouselpicture_main);
        initView();
    }
    private void initView(){
        bvp_vKeBao_bannnerHome = (BannerViewPager) findViewById(R.id.bvp_vKeBao_bannnerHome);
        getBannerList();
    }
    private void getBannerList() {

        smHomepageImageList.clear();
        GetBanner getBanner=new GetBanner();
        List<GetBanner.Img> imgList=new ArrayList<>();
        Log.e("length", String.valueOf(imgList.size()));
        GetBanner.Img img0=getBanner.new Img();
        GetBanner.Img img1=getBanner.new Img();
        GetBanner.Img img2=getBanner.new Img();
        img0.setImgUrl("https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/image/h%3D200/sign=1c3f18c4524e9258b93481eeac83d1d1/b7fd5266d0160924be0452bbd00735fae6cd3468.jpg");
        img0.setLink("http://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&ie=utf-8&in=24401&cl=2&lm=-1&st=-1&step_word=&rn=1&cs=&ln=1998&fmq=1402900904181_R&ic=0&s=&se=1&sme=0&tab=&width=&height=&face=0&is=&istype=2&ist=&jit=&fr=ala&ala=1&alatpl=others&pos=1&pn=0&word=%E5%9B%BE%E7%89%87%20%E5%8A%A8%E6%BC%AB%E5%8D%A1%E9%80%9A&di=0&os=2130772427,235879211&pi=0&objurl=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F4%2F510f446941311.jpg");
        img1.setImgUrl("https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/image/h%3D200/sign=6008b360f336afc3110c38658318eb85/a1ec08fa513d26973aa9f6fd51fbb2fb4316d81c.jpg");
        img1.setLink("http://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&ie=utf-8&in=24401&cl=2&lm=-1&st=-1&step_word=&rn=1&cs=&ln=1998&fmq=1402900904181_R&ic=0&s=&se=1&sme=0&tab=&width=&height=&face=0&is=&istype=2&ist=&jit=&fr=ala&ala=1&alatpl=others&pos=1&pn=1&word=%E5%9B%BE%E7%89%87%20%E5%8A%A8%E6%BC%AB%E5%8D%A1%E9%80%9A&di=0&os=1199087710,2399135616&pi=0&objurl=http%3A%2F%2Fv.flash.beijingww.com%2Fcomic%2Fwallpaper%2Fjiqimao%2F15.jpg");
        img2.setImgUrl("https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/image/h%3D200/sign=07d5f93fa00f4bfb93d09954334e788f/a8ec8a13632762d072d4321fa4ec08fa503dc6ac.jpg");
        img2.setLink("http://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&ie=utf-8&in=24401&cl=2&lm=-1&st=-1&step_word=&rn=1&cs=&ln=1998&fmq=1402900904181_R&ic=0&s=&se=1&sme=0&tab=&width=&height=&face=0&is=&istype=2&ist=&jit=&fr=ala&ala=1&alatpl=others&pos=1&pn=2&word=%E5%9B%BE%E7%89%87%20%E5%8A%A8%E6%BC%AB%E5%8D%A1%E9%80%9A&di=0&os=1060733126,4043701539&pi=0&objurl=http%3A%2F%2Fimage2.90e.com%2Fimage%2F1024x768%2F12764.jpg");
        imgList.add(0, img0);
        imgList.add(1,img1);
        imgList.add(2,img2);
        getBanner.setData(imgList);
        Log.e("get",getBanner.getData().toString());
        smHomepageImageList.addAll(getBanner.getData());
        bvp_vKeBao_bannnerHome.createView(smHomepageImageList);
        bvp_vKeBao_bannnerHome.startRoll();
    }


    @Override
    public void onPause() {
        bvp_vKeBao_bannnerHome.stopRoll();
        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
        bvp_vKeBao_bannnerHome.startRoll();
    }

}
